﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using KOPLibrary.DataManagement;

namespace KOPLibrary.Forms
{
    public partial class BindWordDocumentForm : Form
    {
        private AbstractData data;

        public BindWordDocumentForm()
        {
            InitializeComponent();
        }

        public bool AllowMultiSelect { get { return ctlAbstractDataViewer.AllowMultiSelect; } set { ctlAbstractDataViewer.AllowMultiSelect = value; } }

        public static void ExecuteForm(AbstractData data)
        {
            ExecuteForm(data, false);
        }

        public static void ExecuteForm(AbstractData data, bool allowMultiSelect)
        {
            BindWordDocumentForm form = new BindWordDocumentForm();
            form.AllowMultiSelect = allowMultiSelect;
            form.Execute(data);
        }

        private void BindWordDocumentForm_Load(object sender, EventArgs e)
        {


        }

        private void Execute(AbstractData data)
        {
            this.data = data;
            ctlAbstractDataViewer.DataSource = data;
            if (this.AllowMultiSelect)
            {
                ctlAbstractDataViewer.ctlButtonpanel.Visible = true;
            }
            ShowDialog();
        }

        private void ctlOK_Click(object sender, EventArgs e)
        {
            ctlAbstractDataViewer.FilterData(data);
            DialogResult = System.Windows.Forms.DialogResult.OK;
        }

        private void ctlAbstractDataViewer_Load(object sender, EventArgs e)
        {

        }
    }
}
